
import { FormOptions } from '../../../components/form/src/types/type'

const options:FormOptions[] = [
  {
    type: 'input',
    value: 'admin',
    label: '用户名',
    prop: 'username',
    rules: [
      {
        required: true,
        message: '用户名不能为空',
        trigger: 'change'
      },
      {
        min: 2,
        max: 6,
        message: '用户名在2-6位之间',
        trigger: 'change'
      }
    ],
    attrs: {
      clearable: true
    }
  },
  {
    type: 'input',
    value: '123456',
    label: '密码',
    prop: 'password',
    rules: [
      {
        required: true,
        message: '密码不能为空',
        trigger: 'change'
      },
      {
        min: 6,
        max: 15,
        message: '密码在6-15位之间',
        trigger: 'change'
      }
    ],
    attrs: {
      showPassword: true,
      clearable: true
    }
  },
  {
    type: 'select',
    value: 3,
    placeholder: '请选择职位',
    label: '职位',
    prop: 'role',
    rules: [
      {
        required: true,
        message: '职位不能为空',
        trigger: 'change'
      }
    ],
    attrs:{
      style: {
        width: '100%'
      }
    },
    children:[
      {
        type: 'option',
        label: '技术总监',
        value: 1
      },
      {
        type: 'option',
        label: '项目经理',
        value: 2
      },
      {
        type: 'option',
        label: '前端负责人',
        value: 3
      },
      {
        type: 'option',
        label: '后端负责人',
        value: 4
      }
    ]
  },
  {
    type: 'checkbox-group',
    value: [],
    prop: 'like',
    label: '爱好',
    rules: [
      {
        required: true,
        message: '请选择爱好',
        trigger: 'change'
      }
    ],
    children: [
      {
        type: 'checkbox',
        label: '足球',
        value: 1
      },
      {
        type: 'checkbox',
        label: '篮球',
        value: 1
      },
      {
        type: 'checkbox',
        label: '排球',
        value: 1
      }
    ]
  },
  {
    type: 'radio-group',
    value: '',
    prop: 'gender',
    label: '性别',
    rules: [
      {
        required: true,
        message: '请选择性别',
        trigger: 'change'
      }
    ],
    children: [
      {
        type: 'radio',
        label: '男',
        value: 'male'
      },
      {
        type: 'radio',
        label: '女',
        value: 'female'
      },
      {
        type: 'radio',
        label: '保密',
        value: 'not'
      }
    ]
  },
  {
    type: 'upload',
    label: '上传',
    id: 'upload1',
    prop: 'pic',
    uploadAttrs: {
      action: 'https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15',
      multiple: true,
      limit: 3,
      name: 'pic'
    },
    rules: [
      {
        required: true,
        message: '图片不能为空',
        trigger: 'change'
      }
    ],
  },
  {
    type: 'editor',
    id: 'editor',
    value: `
      <p>目前只支持一个上传按钮和一个富文本编辑器</p>
      <p>配置多个会报错</p>
      <p>多个上传按钮和富文本编辑器待后续完善</p>
    `,
    label: '描述',
    prop: 'desc',
    placeholder: '请输入描述',
    rules: [
      {
        required: true,
        message: '描述不能为空',
        trigger: 'change'
      }
    ],
  }
]


const inlineOptions:FormOptions[] = [
  {
    type: 'input',
    value: 'admin',
    label: '用户名',
    prop: 'username',
    rules: [
      {
        min: 2,
        max: 6,
        message: '用户名在2-6位之间',
        trigger: 'change'
      }
    ]
  },
  {
    type: 'input',
    value: '952720230526153606',
    label: '订单编号',
    prop: 'orderId'
  },
  {
    type: 'input',
    value: '123456',
    label: '密码',
    prop: 'password',
    rules: [
      {
        required: true,
        message: '密码不能为空',
        trigger: 'change'
      },
      {
        min: 6,
        max: 15,
        message: '密码在6-15位之间',
        trigger: 'change'
      }
    ],
    attrs: {
      showPassword: true,
    }
  },
  {
    type: 'select',
    value: 3,
    placeholder: '请选择职位',
    label: '职位',
    prop: 'role',
    rules: [
      {
        required: true,
        message: '职位不能为空',
        trigger: 'change'
      }
    ],
    attrs:{
      style: {
        width: '100%'
      }
    },
    children:[
      {
        type: 'option',
        label: '技术总监',
        value: 1
      },
      {
        type: 'option',
        label: '项目经理',
        value: 2
      },
      {
        type: 'option',
        label: '前端负责人',
        value: 3
      },
      {
        type: 'option',
        label: '后端负责人',
        value: 4
      }
    ]
  }
]


export {
  options,
  inlineOptions
}